using System.Collections.Generic;
using System.Windows.Forms;
using ViScript.Core.ParsedSentence;
using ViScript.Core.Utils;

namespace ViScript.Example
{
    public partial class ParsingResultForm : Form
    {
        private readonly IEscapeStrategy escapeStrategy;

        public ParsingResultForm(IEscapeStrategy escapeStrategy)
        {
            this.escapeStrategy = escapeStrategy;
            InitializeComponent();
        }

        public void SetParsingResult(List<IParsedSentence> parsedSentences)
        {
            ParsedSentenceVisualizer visualizer = new ParsedSentenceVisualizer(treeView.Nodes, escapeStrategy);
            foreach (IParsedSentence parsedSentence in parsedSentences)
            {
                parsedSentence.Accept(visualizer);
            }
        }
    }
}